#!/bin/sh
cat << EOF > dummy.c
#include <stdlib.h>

char dummy [0x20000000];

int main ()
{
  (void) malloc (1);
  return 0;
}
EOF

exec 3>&2 2> /dev/null
if gcc dummy.c > /dev/null && ./"$A_OUT"; then
  exec 2>&3
  rm -f "$A_OUT" dummy.c
  $1 $2
  if [ -r "$A_OUT" ] ; then
    ./"$A_OUT"
  else
    echo "failed"
  fi
else
  exec 2>&3
  rm -f dummy.c
  echo "SKIPPED: array size of 512 MB not supported by system"
fi
